//api接口统一管理
import mockRequest from './mockRequest'
import requests from './request';

//三级联动
export const reqCategoryList = () =>requests({url:'/api/product/getBaseCategoryList',method:'get'});
//获取首页轮播图的接口
export const reqGetBannerList = ()=>mockRequest.get('/banner')
//获取楼层数据的接口
export const reqGetFloorList = ()=>mockRequest.get('/floor') 
//获取搜索模块的地址/api/list 请求方式post请求
export const reqGetSearchInfo = (params) => requests({url:"/api/list",method:'post',data:params});
//获取详情信息的接口 /api/item/{ skuId } GET
export const reqGoodsInfo = (skuId) => requests({url:`/api/item/${ skuId }`,method:'get'});
//将产品添加到购物车，或获取更新的某一个产品的个数 /api/cart/addToCart/{ skuId }/{ skuNum } POST
export const reqAddOrUpdateShopCart =  (skuId,skuNum) => requests({url:`/api/cart/addToCart/${skuId}/${skuNum}`,method:'post'})
//获取购物车列表数据 /api/cart/cartList GET
export const reqCartList = ()=> requests({url:'/api/cart/cartList',methods:'get'})
//删除购物产品的接口 /api/cart/deleteCart/{skuId}  DELETE
export const reqDeleteCartById = (skuId) => requests({url:`/api/cart/deleteCart/${skuId}`,method:'delete'})
//修改选中状态 /api/cart/checkCart/{skuID}/{isChecked} GET
export const reqUpdateCheckedById = (skuId,isChecked) => requests({url:`/api/cart/checkCart/${skuId}/${isChecked}`,method:'get'})
//获取验证码   /api/user/passport/sendCode/{phone}  GET
export const reqGetCode = (phone)=> requests({url:`/api/user/passport/sendCode/${phone}`,method:'get'})
//注册的接口 /api/user/passport/register post 带 phone password code属性
export const reqUserRegister = (data) => requests({url:'/api/user/passport/register',method:'POST',data})
//登录接口 /api/user/passport/login POST
export const reqUserLogin = (data) => requests({url: '/api/user/passport/login',method: 'POST',data})
//获取用户信息【携带token】 /api/user/passport/auth/getUserInfo GET
export const reqGetUserInfo = () => requests({url: '/api/user/passport/auth/getUserInfo',method: 'GET'})
// 退出登录 /api/user/passport/logout GET
export const reqLogout = () => requests({url: '/api/user/passport/logout',method: 'GET'})
// 获取用户地址信息 /api/user/userAddress/auth/findUserAddressList
export const reqAddressInfo = () => requests({url:'/api/user/userAddress/auth/findUserAddressList',method:'GET'})
 /**获取用户交易页信息*/
export const reqOrderInfo = () => requests({url: '/api/order/auth/trade',method: 'GET'})
//提交订单
export const reqSubmitOrder = (tradeNo, data) => requests({url: `/api/order/auth/submitOrder?tradeNo=${tradeNo}`,method: 'POST',data})
//获取支付信息 购买的信息
export const reqPayInfo = (orderId) => {
    return requests({
      url: `/api/payment/weixin/createNative/${orderId}`,
      method: 'GET'
    })
  }
/**获取订单支付状态 支付成功与失败*/
export const reqPayStatus = (orderId) => {
  return requests({
    url: `/api/payment/weixin/queryPayStatus/${orderId}`,
    method: 'GET'
  })
}
/**
 * 获取我的订单列表
 */
 export const reqMyOrderList = (page, limit) => {
  return requests({
    url: `/api/order/auth/${page}/${limit}`,
    method: 'GET'
  })
}
  
    
  




